import pytest
from api.ihrm_login import login_Api
from common.ihrm_assert import common_assert
from common.read_login_data import read_json
from config import BASE_DIR


class Test_login:
    data_login = read_json(BASE_DIR + '/data/login_data.json')

    @pytest.mark.parametrize('desc, data_login,  status_code, code, success, message', data_login)
    def test_login_ihrm(self, desc, data_login,  status_code, code, success, message):
        # req_data = BASE_DIR + '/data/login_data.json'
        resp = login_Api.login(data_login)
        print(desc, ':', resp.json())
        common_assert(resp, status_code, code, success, message)